package com.cec.mapper.admin;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cec.dto.CategoryDTO;
import com.cec.dto.InfoDTO;
import com.cec.entity.Info;
import com.cec.vo.HomeDataVO;
import com.cec.vo.InfoVO;
import com.cec.vo.CategoryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 资讯表 Mapper 接口
 * </p>
 *
 * @author lt
 * @since 2024-10-25
 */
public interface InfoMapper extends BaseMapper<Info> {

    IPage<InfoVO> pageQueryInfo(Page<Object> objectPage, @Param(Constants.WRAPPER) QueryWrapper<InfoDTO> wrapper);

    @Select("select id,type_name name from info_type;")
    List<CategoryVO> queryInfoType();

    /**
     * 批量插入
     * @param infoList
     * @return
     */
    int insertBatch(ArrayList<Info> infoList);

    List<HomeDataVO> getHomeInfoData(@Param(Constants.WRAPPER) QueryWrapper<Info> wrapper);

    @Select("select id,type_name name from info_type   ${ew.customSqlSegment}")
    IPage<CategoryVO> pageQueryInfoType(Page<Object> objectPage,@Param(Constants.WRAPPER) QueryWrapper<CategoryDTO> wrapper);
}
